<!DOCTYPE html>
<html dir="ltr" lang="<?php echo str_replace('_', '-', osc_current_user_locale()); ?>">
    <head>
        <?php osc_current_web_theme_path('head.php') ; ?>
        <?php if(osc_count_items() == 0) { ?>
            <meta name="robots" content="noindex, nofollow" />
            <meta name="googlebot" content="noindex, nofollow" />
        <?php } else { ?>
            <meta name="robots" content="index, follow" />
            <meta name="googlebot" content="index, follow" />
        <?php } ?>
		
		
		
	<!-- Jquery Slider -->
	<link rel="stylesheet" href="<?php echo osc_current_web_theme_styles_url('jquery.ui.all.css') ; ?>">
      
	<script src="<?php echo osc_current_web_theme_url('js/jquery-1.7.2.js') ; ?>"></script>
	<script src="<?php echo osc_current_web_theme_url('js/ui/jquery.ui.core.min.js') ; ?>"></script>
	<script src="<?php echo osc_current_web_theme_url('js/ui/jquery.ui.widget.min.js') ; ?>"></script>
	<script src="<?php echo osc_current_web_theme_url('js/ui/jquery.ui.mouse.min.js') ; ?>"></script>
	<script src="<?php echo osc_current_web_theme_url('js/ui/jquery.ui.slider.min.js') ; ?>"></script>
	
	<style>
		.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border-color:#BBBBBB; width:10px;}
	</style>
	<script>
	$(function() {
		$( "#slider-range" ).slider({
			range: true,
			min: 0,
			max: 100000,
			step:100,
			values: [ 0, 100000 ],
			slide: function( event, ui ) {
				$( "#priceMin" ).val(ui.values[ 0 ]);
				$( "#priceMax" ).val(ui.values[ 1 ]);
			}
		});
		
		//$( "#priceMin" ).val($( "#slider-range" ).slider( "values", 0 ));
		//$( "#priceMax" ).val($( "#slider-range" ).slider( "values", 1 ));
	});
	</script>
	<!-- Jquery slider end -->
	<script type="text/javascript">	
		$(document).ready(function() { 
						
                        numericInputDot('priceMin');
                        numericInputDot('priceMax');
                        numericInput('year');
                        numericInput('km');
			
			
			
			//Prize Slide
			if($('#priceMin').val() != "" || $('#priceMax').val() != "")
				$( "#slider-range" ).slider( "option", "values", [$('#priceMin').val(),$('#priceMax').val()] );
			
			});
		</script>
    </head>
    <body>
        <?php osc_current_web_theme_path('header.php') ; ?>
        <div class="container">
            <?php twitter_show_flash_message() ; ?>
        </div>
        <!-- content -->
        <div class="container container-fluid search">
            <?php echo twitter_breadcrumb('&raquo;') ; ?>			
            <!-- sidebar -->
	    <div style="float:left; width:230px; ">			
            <!--<div class="sidebar well">-->
	    <div id="filters" class="sidebar well-search-green">
                <span class="titleSearch" style="color:#347A46;">
                    <?php _e('Advanced Search', 'twitter') ; ?>
                </span>
                <form action="<?php echo osc_base_url(true); ?>" method="get" style="margin-bottom:0px;">
                    <input type="hidden" id="cat" name="sCategory" value="<?php echo Params::getParam('sCategory'); ?>" />
                    <input type="hidden" name="page" value="search" />
                        <fieldset>
                          <?php if( osc_images_enabled_at_items() ) { ?>

                            <ul class="inputs-list">
                                <li>
                                                                    <label>
                                    <input type="checkbox" name="bPic" id="withPicture" value="1" <?php echo (osc_search_has_pic() ? 'checked' : ''); ?> />
                                    <span for="withPicture"><b><?php _e('Only with pictures', 'twitter') ; ?></b></span>
                                                                    </label>
                                </li>
                            </ul>
                            <?php } ?>					  
                        </fieldset>			
                    <?php 
                        if(osc_search_category_id()) {
							
                            osc_run_hook('search_form', osc_search_category_id()) ;
                        } else {
                            osc_run_hook('search_form') ;
                        }
                    ?>      
					
					<?php if (count(osc_get_countries())>1) { ?>
                    <fieldset>
                        <h5><?php _e('Country', 'twitter') ; ?></h5>
                        <div class="clearfix">
                            <!--<input type="text" name="sCity" id="sCity" value="<?php //echo osc_search_city() ; ?>" />-->
							 <?php $country = Params::getParam('sCountry') ; ?>
							<?php item_country_combo($country) ; ?>
                        </div>
                    </fieldset>
				
					<?php } else { ?>
					 <fieldset>
                        <h5><?php _e('Region', 'twitter') ; ?></h5>
                        <div class="clearfix">
							 <?php $reg = Params::getParam('sRegion') ; ?>
							<?php item_region_combo($reg) ; ?>
                        </div>
                    </fieldset>
                    
					<?php } ?>					
				
                    <fieldset>
                            <?php if( osc_price_enabled_at_items() ) { ?>
                          
                                <h5><?php _e('Price', 'twitter') ; ?></h5>
                                <div style="">
                                    <br/>
                                    <div id="slider-range" style="width:90%;margin:auto;"></div>
                                    <br/>
                                    <div style="display:inline-block;width:100%;">
                                    <?php //_e('Min', 'modern') ; ?>
                                    <span style="float:left;"><input type="text" id="priceMin" name="sPriceMin" value="<?php echo osc_search_price_min() ; ?>" size="7" maxlength="10" /></span>
                                    <span style="text-align:center;vertical-align:middle;margin-left:6%;margin-right:6%;"><?php _e('to', 'twitter') ; ?></span>
                                    <?php //_e('Max', 'modern') ; ?>
                                    <span style="float:right;"><input type="text" id="priceMax" name="sPriceMax" value="<?php echo osc_search_price_max() ; ?>" size="7" maxlength="10" /></span>
                                    </div>
                                    <div style="display:inline-block;width:100%;text-transform:lowercase;">
                                            <span style="float:left;"><small><?php _e('Min', 'modern') ; ?></small></span>									
                                            <span style="float:right;"><small> <?php _e('Max', 'modern') ; ?></small></span>
                                    </div>
                                </div>
                            <?php } ?>
							
		</fieldset>
                    <br/>
                    <fieldset>
                        <h5><?php _e('Your search', 'twitter') ; ?></h5>
                        <div class="clearfix">
                            <input type="text" name="sPattern" id="query" value="<?php echo osc_search_pattern() ; ?>" size="28" />
                        </div>
                    </fieldset>
                    <?php 
                        View::newInstance()->_erase('subcategories') ;
                        View::newInstance()->_erase('categories') ; 
                    ?>
                    <?php if (false) if ( osc_count_categories() ) { ?>
                    <fieldset style="display:none;">
                        <h4><?php _e('Categories', 'twitter') ; ?></h4>
                        <div class="clearfix">
                            <ul class="inputs-list">
                            <?php // RESET CATEGORIES IF WE USED THEN IN THE HEADER ?>
                            <?php osc_goto_first_category() ; ?>
                                <?php while( osc_has_categories() ) { ?>
                                <li>
                                    <label>
                                        <?php
                                            $rootCategory = Category::newInstance()->findSubcategories(osc_category_id()) ; 
                                            $isParent     = false ;
                                            foreach($rootCategory as $c) {
                                                if( in_array($c['pk_i_id'], osc_search_category()) ) {
                                                    $isParent = true ;
                                                }
                                            }
                                        ?>
                                        <input type="checkbox" id="cat<?php echo osc_category_id(); ?>" name="sCategory[]" value="<?php echo osc_category_id(); ?>" <?php echo ( (in_array(osc_category_id(), osc_search_category()) || $isParent || in_array(osc_category_slug() . "/", osc_search_category()) || count(osc_search_category()) == 0 )  ? 'checked' : '') ; ?> />
                                        <span><?php echo osc_category_name(); ?></span>
                                    </label>
                                    <!--
                                    <?php if ( osc_count_subcategories() > 0 ) { ?>
                                    <ul class="inputs-list">
                                        <?php while ( osc_has_subcategories() ) { ?>
                                        <li>
                                            <input type="checkbox" id="cat<?php echo osc_category_id(); ?>" name="sCategory[]" value="<?php echo osc_category_id(); ?>" <?php echo ( (in_array(osc_category_id(), osc_search_category())  || in_array(osc_category_slug()."/", osc_search_category()) || count(osc_search_category())==0 )  ? 'checked' : '') ; ?> />
                                            <span><?php echo osc_category_name(); ?></span>
                                        </li>
                                        <?php } ?>
                                    </ul>
                                    <?php } ?>
                                    -->
                                </li>
                                <?php } ?>
                            </ul>
                        </div>
                    </fieldset>
                    <?php } ?>
                     
                    <button class="btngreensimple" type="submit" style="width:100%;"><?php _e('Apply', 'twitter') ; ?></button>
                </form>                      
            </div>
            <!-- sidebar end -->
                <div class="well-search-mail">
		 <?php osc_alert_form() ; ?>
		</div>
                <div class="social_links well-search" style="display:none;">                 
                   <?php  socialLinks(); ?>
                </div>
            </div>
            <?php osc_current_web_theme_path('v35extra/adstopsearch.php') ; ?>
            <div class="content well-content" style="width:658px;">                
                <?php require('search_list.php') ; ?> 
            </div>
        </div>
        <?php osc_current_web_theme_path('footer.php') ; ?>
    </body>
</html>